#!/usr/bin/env python

"""
Test code for pypownce
"""

import os
import pownce

userid = 'USERNAME'
passwd = 'PASSWORD'

if os.path.exists('test.cfg'):
    for line in open('test.cfg', 'r').readlines():
        if len(line) > 1:
            key, value = line[:-1].split('=', 1)
            key   = key.strip().lower()
            value = value.strip()

            if key == 'userid':
                userid = value
            if key == 'password':
                passwd = value

o = pownce.Session()

o.login(userid, passwd)

print o.userinfo
print o.sets
print o.friends
print o.fan_of

f = pownce.Feed(o)

m = pownce.File('test file', 'friend_31701', '/Users/bear/temp/test.txt')
f.push(m)

